from django.db import models
import uuid

# Create your models here.
class User(models.Model):
    name = models.CharField(max_length=100)

    def __str__(self):
        return self.name


class Classes(models.Model):
    name = models.CharField(max_length=30, unique=True)

    def __str__(self):
        return self.name


class Label(models.Model):
    name = models.CharField(max_length=30, unique=True)

    def __str__(self):
        return self.name


class UserDetails(models.Model):
    age = models.IntegerField(null=True, blank=True)
    sex = models.BooleanField(null=True, blank=True)
    user = models.OneToOneField(User, on_delete=models.CASCADE)

class ImageVerifyCode(models.Model):
    uuid = models.UUIDField(primary_key=True,default=uuid.uuid4, editable=False)
    code = models.CharField(max_length=10)
    func = models.CharField(max_length=100, default=' ')
    create_at = models.DateTimeField(auto_now_add=True)
    def __str__(self):
        return str(self.uuid)

class Article(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    title = models.CharField(max_length=100)
    desc = models.TextField()
    pic_url = models.CharField(max_length=100)
    url = models.CharField(max_length=100)